<template>
    <div class="orders">
        <el-input placeholder="请输入内容" v-model="params.query" class="input-with-select ssval">
            <el-button slot="append" icon="el-icon-search" @click="ssval"></el-button>
        </el-input>
        <!-- 表格 -->
        <template>
            <el-table :data="tableData" border style="width: 100%">
                <el-table-column type="index" width="50">
                </el-table-column>
                <el-table-column prop="order_number" label="订单编号">
                </el-table-column>
                <el-table-column prop="order_price" label="订单价格">
                </el-table-column>
                <el-table-column  label="是否支付">
                    <template slot-scope="scope">
                        <el-button type="danger"  size="mini" plain v-if="scope.row.pay_status==0">未付款</el-button>
                        <el-button type="success" size="mini" plain v-if="scope.row.pay_status==1">已付款</el-button>
                    </template>
                </el-table-column>
                <el-table-column prop="is_send" label="是否发货">
                </el-table-column>
                <el-table-column prop="update_time" label="下单时间">
                </el-table-column>
                <el-table-column label="操作">
                    <template slot-scope="scope">
                        <el-button size="mini">编辑</el-button>
                        <el-button size="mini" type="success">定位</el-button>
                    </template>
                </el-table-column>
            </el-table>
        </template>
        <!-- 分页 -->
        <div class="block">
                <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
                    :current-page="params.pagenum" :page-sizes="[10, 20, 30, 40]" :page-size="params.pagesize"
                    layout="total, sizes, prev, pager, next, jumper" :total="total">
                </el-pagination>
    </div>
</div></template>

<script>
import { getorders } from "../utils/orders"
export default {
    data() {
        return {
            tableData: [],
            params: {
                query: "",
                pagenum: 1,
                pagesize: 10
            },
            total: 0
        }
    },
    methods: {
        getDataorder() {
            getorders(this.params).then(res => {
                console.log(56, res);
                this.tableData = res.data.goods
                this.total=res.data.total
            })
        },
        handleSizeChange(val){
            this.params.pagesize=val
            this.getDataorder()
        },
        handleCurrentChange(val){
            this.params.pagenum=val
            this.getDataorder()
        },
        //搜索
        ssval() { 
            this.getDataorder()
        }
    },
    created() {
        this.getDataorder()
    },
    mounted() {

    },
    components: {

    },
    computed: {

    },
    watch: {

    },
}
</script>

<style lang='scss' scoped>
.orders {
    width: 100%;
    padding: 20px;
    box-sizing: border-box;
    background-color: #fff;
}
</style>
